158ed8579c470a9f1ec46301180dc1d6fa9337e8,trunk/JLanguageTool/src/java/de/danielnaber/languagetool/openoffice/OOoDialog.java,OOoDialog,showError,#number#,193
Before Change
XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor();
xViewCursor.gotoStart(false);
int errorLength = currentRuleMatch.getToPos() - currentRuleMatch.getFromPos();
xViewCursor.goRight((short)(currentRuleMatch.getFromPos()-replacementCorrection), false);
xViewCursor.goRight((short)errorLength, true);
}
}
After Change
XTextViewCursorSupplier xViewCursorSupplier =
(XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
int errorLength = currentRuleMatch.getToPos() - currentRuleMatch.getFromPos();
if (xViewCursor == null) {
// working on complete text:
XTextViewCursor tmpxViewCursor = xViewCursorSupplier.getViewCursor();
tmpxViewCursor.gotoStart(false);
tmpxViewCursor.goRight((short)(currentRuleMatch.getFromPos()-replacementCorrection), false);
tmpxViewCursor.goRight((short)errorLength, true);
} else {
// working on selected text only:
if (startTextRange == null) {
startTextRange = xViewCursor.getStart();
}
xViewCursor.gotoRange(startTextRange, false);
xViewCursor.goRight((short)(currentRuleMatch.getFromPos()-replacementCorrection), false);
xViewCursor.goRight((short)errorLength, true);
}
}